<form class="layui-form" lay-filter="LAY-app-course-lesson-form" id="LAY-app-course-lesson-form"
      style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">当前课程</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">章节名称</label>
        <div class="layui-input-block">
            <script type="text/html" template>
                <input type="text" name="title" lay-verify="required" placeholder="请输入..." autocomplete="off"
                       class="layui-input" value="{{ d.params.title || '' }}">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">章节封面</label>
        <div class="layui-col-md8">
            <script type="text/html" template>
                <input type="text" name="thumb" placeholder="请选择图片" autocomplete="off" class="layui-input"
                       value="{{ d.params.thumb || '' }}">
            </script>
        </div>
        <button style="float: left;" type="button" class="layui-btn" layadmin-event="select_image">选择图片</button>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">章节类型</label>
        <div class="layui-input-block">
            <input type="radio" name="type" value="0" title="图文章节" checked="" lay-filter="course_type">
            <input type="radio" name="type" value="1" title="音频章节" lay-filter="course_type">
            <input type="radio" name="type" value="2" title="视频章节" lay-filter="course_type">
        </div>
    </div>
    <div class="layui-form-item video-select" style="display: none">
        <label class="layui-form-label">音视频URL</label>
        <div class="layui-col-md8">
            <script type="text/html" template>
                <input type="text" name="video_url" placeholder="请选择视频" autocomplete="off" class="layui-input"
                       value="{{ d.params.video_url || '' }}">
            </script>
        </div>
        <button style="float: left;" type="button" class="layui-btn" layadmin-event="select_video">选择视频</button>
    </div>
    <div class="layui-form-item video-select" style="display: none">
        <label class="layui-form-label">音视频时长</label>
        <div class="layui-input-inline">
            <input type="text" name="video_time" placeholder="如13:14" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">章节内容</label>
        <div class="layui-input-block">
            <script id="container" name="content" type="text/plain" style="width: 800px;height: 350px;"></script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">试听章节</label>
        <div class="layui-input-block">
            <input type="radio" name="is_free" value="0" title="否" checked="">
            <input type="radio" name="is_free" value="1" title="是">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">试听时间</label>
        <div class="layui-input-inline">
            <input type="number" name="free_time" placeholder="0试听整个章节" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-inline">
            <input type="text" name="sort" placeholder="请输入..." autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">课程状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="0" title="审核中" checked="">
            <input type="radio" name="status" value="1" title="上架">
            <input type="radio" name="status" value="2" title="下架">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <input type="button" lay-submit lay-filter="LAY-app-course-lesson-submit" value="确认" class="layui-btn">
        </div>
    </div>
</form>

<!-- 配置文件 -->
<script type="text/javascript" src="static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="static/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
</script>
<script>
    layui.use(['admin', 'form', 'attachment'], function () {
        var $ = layui.$
            , form = layui.form
            , admin = layui.admin;

        form.on('radio(course_type)', function (data) {
            if (data.value === '0') {
                $('.video-select').hide();
            } else {
                $('.video-select').show();
            }
        });
    })
</script>